/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 
	/// module : battleLogic
	/// </summary>
	public class BattleStatisticsUnitPOD : IPOD 
    {
        public readonly static Func<BattleStatisticsUnitPOD> FACTORY = () => new BattleStatisticsUnitPOD();
		public static Func<BattleStatisticsUnitPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        ///  英雄cid
        /// </summary>
		public int cid;
		/// <summary>
        ///  英雄皮肤cid
        /// </summary>
		public int skinCid;
		/// <summary>
        ///  当前血量
        /// </summary>
		public int hp;
		/// <summary>
        ///  当前sp
        /// </summary>
		public int sp;
		/// <summary>
        ///  最大血量
        /// </summary>
		public int maxHp;
		/// <summary>
        ///  最大sp
        /// </summary>
		public int maxSp;
		/// <summary>
        ///  伤害
        /// </summary>
		public int damage;
		/// <summary>
        ///  治疗
        /// </summary>
		public int cure;
		/// <summary>
        ///  受击
        /// </summary>
		public int hurt;
		/// <summary>
        /// 
        /// </summary>
		public bool isMvp;
		
		
		
		/*-- constructors --*/
		public BattleStatisticsUnitPOD() {}
		public BattleStatisticsUnitPOD(int cid, int skinCid, int hp, int sp, int maxHp, int maxSp, int damage, int cure, int hurt, bool isMvp) {
			this.cid = cid;
			this.skinCid = skinCid;
			this.hp = hp;
			this.sp = sp;
			this.maxHp = maxHp;
			this.maxSp = maxSp;
			this.damage = damage;
			this.cure = cure;
			this.hurt = hurt;
			this.isMvp = isMvp;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_int(cid);
            _out.Write_int(skinCid);
            _out.Write_int(hp);
            _out.Write_int(sp);
            _out.Write_int(maxHp);
            _out.Write_int(maxSp);
            _out.Write_int(damage);
            _out.Write_int(cure);
            _out.Write_int(hurt);
            _out.Write_boolean(isMvp);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            cid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            skinCid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            hp = _in.Read_int();
            if(!_in.HasRemaining()) return;
            sp = _in.Read_int();
            if(!_in.HasRemaining()) return;
            maxHp = _in.Read_int();
            if(!_in.HasRemaining()) return;
            maxSp = _in.Read_int();
            if(!_in.HasRemaining()) return;
            damage = _in.Read_int();
            if(!_in.HasRemaining()) return;
            cure = _in.Read_int();
            if(!_in.HasRemaining()) return;
            hurt = _in.Read_int();
            if(!_in.HasRemaining()) return;
            isMvp = _in.Read_boolean();
        }
		
		public BattleStatisticsUnitPOD Clone() {
            BattleStatisticsUnitPOD o = DynamicFactory();
            o.cid = cid;
            o.skinCid = skinCid;
            o.hp = hp;
            o.sp = sp;
            o.maxHp = maxHp;
            o.maxSp = maxSp;
            o.damage = damage;
            o.cure = cure;
            o.hurt = hurt;
            o.isMvp = isMvp;
            return o;
        }
        
        public void Clear() {
            cid = default;
            skinCid = default;
            hp = default;
            sp = default;
            maxHp = default;
            maxSp = default;
            damage = default;
            cure = default;
            hurt = default;
            isMvp = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "BattleStatisticsUnitPOD [";
			str += "cid=";
			str += cid;
			str += ", skinCid=";
			str += skinCid;
			str += ", hp=";
			str += hp;
			str += ", sp=";
			str += sp;
			str += ", maxHp=";
			str += maxHp;
			str += ", maxSp=";
			str += maxSp;
			str += ", damage=";
			str += damage;
			str += ", cure=";
			str += cure;
			str += ", hurt=";
			str += hurt;
			str += ", isMvp=";
			str += isMvp;
			str += "]";
			return str;
		}
		
	}
}